%\documentclass[13pt, a4paper]{report}

%\usepackage{color,graphics,graphicx,colortbl}
%\usepackage{mathpple,amsmath,mathrsfs}
%\usepackage{parskip}
% redefine some case

%\begin{document}

%\section{Moore's algorithm}
\chapter{Analysis}
\subsection{Data structure}
	In this project, the data structure was based on the Java libraries. Besides, we also have defined classes for implementing algorithms.
	\subsubsection{The data structure in Java libraries was used:}
		\begin{itemize}
		\item java.util.ArrayList
		\item java.util.HashMap
		\item java.util.HashSet
		\item java.util.Iterator
		\item java.util.Map
		\end{itemize}
	\subsubsection{The data structure was defined:}
		\paragraph{{\color{black}Interfaces}}\
			\begin{itemize}
				\item interfaces.State \hfill\\\\
					\begin{tabular}[c]{|l|l|l|}
						\hline
						\multicolumn{3}{|l|}{Operations}\\
						\hline
						\rowcolor{cyan}
						Type return & Method & Description\\ \hline
						boolean & initial() & Get the initial value of state\\ \hline
						boolean & terminal() & Get the terminal value of state\\ \hline
						Object & label() & Get the label of state\\ \hline
					\end{tabular}
				\item interfaces.Transtion\textless T\textgreater \hfill\\\\
					\begin{tabular}[c]{|l|l|l|}
						\hline
						\multicolumn{3}{|l|}{Operations}\\
						\hline
						\rowcolor{cyan}
						Type return & Method & Description\\ \hline
						State & source() & Get the source state of transition\\ \hline
						State & target() & Get the target state of transition\\ \hline
						T & label() & Get the label of transition\\ \hline
					\end{tabular}
			\end{itemize}
		\paragraph{{\color{black}Classes}}
			\subparagraph{Helper}
				\begin{itemize}
					\item helper.FileOperations\hfill\\\\
						\begin{tabular}[c]{|l|l|l|}
							\hline
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline
							DFA & readFile(String fileName)& Get automata from text file\\ \hline							
						\end{tabular}
					\item helper.GenerateAutomata\hfill\\\\
						\begin{tabular}[c]{|l|p{5cm}|p{5cm}|}
							\hline
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline
							DFA & generateAutomata(int alphabetS,int numState,int numTrans)& Generate automata in automatically\\ \hline							
						\end{tabular}
				\end{itemize}
			\subparagraph{Automaton}
				\begin{itemize}
					\item automaton.StateImpl (implements interfaces.State)\hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{5cm}|p{5cm}|p{5cm}|}
							\hline
							\multicolumn{3}{|l|}{Attributes}\\
							\hline
							\rowcolor{cyan}
							Type return & Property & Description\\ \hline
							boolean & initial & The initial state of a State\\ \hline
							boolean & terminal & The terminal state of a State\\ \hline
							String & label & The label of a State\\ \hline
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline
							boolean & initial() & Get the initial value of a State\\ \hline
							boolean & terminal() & Get the terminal value of a State\\ \hline
							Object & label() & Get the label of a State\\ \hline
							void & setInitial() & Set the initial value of a State\\ \hline
							void & setTerminal() & Set the terminal value of a State\\ \hline
							void & setLabel() & Set the label of a State\\ \hline
							void & reversed(State s) & Reversed a State\\ \hline
							boolean & equals(Object arg) & Redefine two States is equal.\\ \hline
							String & toString() & Get and print information of State\\ \hline
							 & StateImpl(String label, boolean init, boolean end) & Constructed of a State\\ \hline
						\end{tabular}
						}
					\item automaton.TranstionImpl\textless String\textgreater (implements interfaces.Transtion\textless T\textgreater)\hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{5cm}|p{5cm}|p{5cm}|}
							\hline
							\multicolumn{3}{|l|}{Attributes}\\
							\hline
							\rowcolor{cyan}
							Type return & Property & Description\\ \hline
							State & sourceState & The source state of a transition\\ \hline
							State & destinationState & The destination state of a transition\\ \hline
							String & label & The label of a transition\\ \hline
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline
							State & source() & Get the source state of a transition\\ \hline
							State & target() & Get the target state of a transition\\ \hline
							String & label() & Get the label of a transition\\ \hline
							void & setSource() & Set the source state of a transition\\ \hline
							void & setTarget() & Set the target state of a transition\\ \hline
							void & setLabel() & Set the label of a transition\\ \hline
							void & reversed(Transition \textless String\textgreater t) & Reversed a transition\\ \hline
								 & TransitionImpl(State init, State end, String label) & Constructed of a transition\\ \hline
						\end{tabular}
						}
					\item automaton.DFA \hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{5cm}|p{5cm}|p{5cm}|}
							\hline
							\multicolumn{3}{|l|}{Attributes}\\
							\hline
							\rowcolor{cyan}
							Type return & Property & Description\\ \hline
							State & initialState & The initial state of automata\\ \hline
							Map\textless State, Map\textless String, Transition\textless String\textgreater\textgreater \textgreater & automaton & The automata\\ \hline
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline
							void & addState(State s) & Add a State into automata\\ \hline
							Transition\textless String\textgreater & getTransition(State s, Object a) & Get the transition in automata with initial state and label of transition\\ \hline
							Map\textless State, Map\textless String, Transition\textless String\textgreater\textgreater \textgreater & getDFA() & Get the automata\\ \hline
							void & printString() & Printing the automata\\ \hline
								 & DFA(Transition[] \textless String\textgreater transitions) & Constructed of a automata\\ \hline
						\end{tabular}
						}
				\end{itemize}
			\subparagraph{Exceptions}
				\begin{itemize}
					\item exceptions.NotDeterministInitalStateException (extends java.lang.Exception)\hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{3cm}|p{7cm}|p{5cm}|}
							\hline							
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline							
								 & NotDeterministInitalStateException (DFA automata) & Constructed of a initial state exception\\ \hline
						\end{tabular}
						}
					\item exceptions.NotDeterministTransitionException (extends java.lang.Exception)\hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{3cm}|p{7cm}|p{5cm}|}
							\hline							
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline							
								 & NotDeterministTransitionException (DFA automata) & Constructed of a transition exception\\ \hline
						\end{tabular}
						}
					\item exceptions.UnknownInitialStateException (extends java.lang.Exception)\hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{3cm}|p{7cm}|p{5cm}|}
							\hline							
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline							
								 & UnknownInitialStateException(DFA automata) & Constructed of an unknown initial state exception\\ \hline
						\end{tabular}
						}
				\end{itemize}
			\subparagraph{Minimization using Moore's algorithm}
				\begin{itemize}
					\item moore.HandleHashSet (extends java.util.HashSet \textless State\textgreater)\hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{3cm}|p{6cm}|p{6cm}|}
							\hline							
							\multicolumn{3}{|l|}{Operations}\\
							\hline		
							\rowcolor{cyan}					
							Type return & Method & Description\\ \hline							
								 & HandleHashSet() & Constructed of a set state\\ \hline
							HandleHashSet & union(HandleHashSet setA,HandleHashSet setB) & Union of two sets\\ \hline
							HandleHashSet & interSection(HandleHashSet setA,HandleHashSet setB) & Intersection of two sets\\ \hline
							boolean & checkStateIntoSet(HandleHashSet setA,State s) & Check a state belongs in a set or not\\ \hline
							boolean & subSet(HandleHashSet setA) & Check a set is a subset of another set or not\\ \hline
							State & toState(HandleHashSet setA) & Combine all states in a set into a state\\ \hline
							ArrayList \textless State \textgreater & getStates(HandleHashSet setA) & Get all states in a set\\ \hline
							boolean & equals(Object arg) & Redefined two set are equal\\ \hline
							void & printString(HandleHashSet arg) & Print all elements in set\\ \hline
						\end{tabular}
						}
					\item moore.Moore\_Algorithm \hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{3cm}|p{6cm}|p{6cm}|}
							\hline							
							\multicolumn{3}{|l|}{Operations}\\
							\hline		
							\rowcolor{cyan}					
							Type return & Method & Description\\ \hline							
								 & HandleHashSet() & Constructed of a set state\\ \hline
							HashSet \textless HandleHashSet \textgreater & initial(DFA automata) & Initial the first partition.\\ \hline
							HashSet \textless String \textgreater & getLabels(DFA automata) & Get the characters in the alphabet of automata\\ \hline
							HashSet \textless HandleHashSet \textgreater & intersectionPartitions(HashSet \textless HandleHashSet\textgreater partition1, HashSet \textless HandleHashSet\textgreater partition2 ) & Intersection of two partitions\\ \hline
							HandleHashSet & partitionEquivalence(DFA automata, HandleHashSet set, String a) & Get equivalence of a set on an alphabet\\ \hline
							HashSet \textless HandleHashSet\textgreater & partitionsEquivalence(DFA automata, HashSet\textless HandleHashSet \textgreater sets, String a) & Get equivalence of a partition on an alphabet\\ \hline
							HashSet \textless HandleHashSet\textgreater & moore\_Equivalence(DFA automata) & Get Moore equivalence\\ \hline
							DFA & minimizeAutomata(DFA automata) & Redefined automata after finding equivalences\\ \hline
						\end{tabular}
						}
				\end{itemize}
			\subparagraph{Minimization using Brzozowski's algorithm}
				\begin{itemize}
					\item bski.Brzozowski \hfill\\\\
					\resizebox{15cm}{!}{
						\begin{tabular}[c]{|p{3cm}|p{7cm}|p{5cm}|}
							\hline							
							\multicolumn{3}{|l|}{Operations}\\
							\hline
							\rowcolor{cyan}
							Type return & Method & Description\\ \hline							
							DFA & reverseAutomata(DFA automata) & Conversing input automata\\ \hline
							DFA & makeTrimmingAutomata(DFA automata) & Determinizing and trimming automata\\ \hline
							List \textless State\textgreater & findTargetState(List \textless State\textgreater source, label l) & Find a set of targets from set of sources through label l\\ \hline
							State & createState(List \textless State\textgreater) & Create a state from a list of states\\ \hline
							DFA & doBrzozowski(DFA automata) & Using Brzozowski’s algorithm to minimize automata\\ \hline
						\end{tabular}
					}
				\end{itemize}
	\subsection{Class diagram}
	Base of the data structure, we develop a minimization automaton which implements the minimizes automata algorithms. Besides, we have also had to develop an operation to generate automata in automatically based on an alphabet size, the number of states, the number of transitions. The program was developed in Java environment, so we have the class diagram in below:
	\begin{figure}[h!]
	\includegraphics[width = 15cm]{images/diagram_1}
	\centering
	\caption{Class diagram 1}
	\end{figure}
%\end{document}